﻿using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using WordpressRestApi;

namespace ApiClientTest
{
    /// <summary>Test <see cref="PostClient"/>.</summary>
    [TestClass]
    public class TagClientTest : ClientTestBase
    {
        /// <summary>Query all tags.</summary>
        /// <returns></returns>
        [TestMethod]
        public async Task GetAllTags()
        {
            var client = CreateClient();
            var query = client.Tag.GetAllTags();
            var tags = await query.ToArrayAsync();

            Assert.IsTrue(tags.Length >= 0);
        }

        #region Delete Tags, done on a specific tag slugs
        [TestMethod]
        [Ignore]
        public async Task DeleteTag()
        {
            const string SLUG = "architecture";

            var client = CreateClient();
            var tag = await client.Tag.DeleteTagAsync(SLUG);

            Assert.AreEqual(SLUG, tag.Slug, "Slug");
        }
        #endregion
    }
}